package com.zhonghui.carbonReport.controller;

import com.zhonghui.common.annotation.Log;
import com.zhonghui.common.core.controller.BaseController;
import com.zhonghui.common.core.domain.AjaxResult;
import com.zhonghui.common.core.page.TableDataInfo;
import com.zhonghui.common.enums.BusinessType;
import com.zhonghui.common.utils.poi.ExcelUtil;
import com.zhonghui.mes.domain.vo.MesProductInspectorVo;
import com.zhonghui.mes.service.IMesProductInspectorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 生产检验报表统计Controller
 *
 * @author zhonghui
 * @date 2022-05-29
 */
@Api(tags = {"制造执行MES-生产检验报表统计"})
@RestController
@RequestMapping("/carbonReport/mesCheck")
public class MesCheckReportController extends BaseController {

    @Autowired
    private IMesProductInspectorService mesProductInspectorService;

    @GetMapping("/productCheck/list")
    @ApiOperation("查询生产检验列表")
    public TableDataInfo<List<MesProductInspectorVo>> list(MesProductInspectorVo mesProductInspectorVo) {
        startPage();
        List<MesProductInspectorVo> list = mesProductInspectorService.selectMesProductInspectorList(mesProductInspectorVo);
        return getDataTable(list);
    }

    @ApiOperation("导出生产检验报表列表")
    @Log(title = "产品检验单", businessType = BusinessType.EXPORT)
    @GetMapping("/productCheck/export")
    public AjaxResult export(MesProductInspectorVo mesProductInspectorVo) {
        List<MesProductInspectorVo> list = mesProductInspectorService.selectMesProductInspectorList(mesProductInspectorVo);
        ExcelUtil<MesProductInspectorVo> util = new ExcelUtil<MesProductInspectorVo>(MesProductInspectorVo.class);
        return util.exportExcel(list, "生产检验报表");
    }
}
